package dto;

import implementor.IndentImpl;
import implementor.IndentItemsImpl;

import java.sql.Date;

import dao.IndentItemsDao;
import dao.IndentsDao;

import model.Update;

public class Indents {
	private int autoId;
	private int generatedId;
	private Date generationDate;
	private int indentNo;
	private int projectId;
	private int state;
	private int version;
	
	//MODEL ATTRIBUTES
	private IndentItems[] modelindentItems;
	private String modelprojectName;
	private String modelgeneratedByName;
	private Update[] modelupdates;
	
	public Indents() {
		// TODO Auto-generated constructor stub
	}
	
	
	// Constructor for DTO attributes
	public Indents(int autoId, int generatedId, Date generationDate,
			int indentNo, int projectId, int state, int version) {
		super();
		this.autoId = autoId;
		this.generatedId = generatedId;
		this.generationDate = generationDate;
		this.indentNo = indentNo;
		this.projectId = projectId;
		this.state = state;
		this.version = version;
	}
	
	
   public static Indents getModelIndentCrspToIndentNo(int autoId) throws Exception
   {
	   IndentsDao dao = new IndentImpl();
	   Indents temp = dao.retreive("autoId",autoId+"");
	   
	   // Generate 1st model attribute that is IndentItems
	   IndentItemsDao daoItems = new IndentItemsImpl();
	   temp.setModelindentItems(daoItems.retreiveArray("indentId",temp.getAutoId()+""));
	   Update[] tempo= Update.getUpdateArrayCrspndIndent(temp.getAutoId());
	   temp.modelupdates=tempo;
	   return temp;
	}
	
	
	
public int getAutoId() {
		return autoId;
	}
	


	public void setAutoId(int autoId) {
		this.autoId = autoId;
	}
	public int getGeneratedId() {
		return generatedId;
	}
	public void setGeneratedId(int generatedId) {
		this.generatedId = generatedId;
	}
	public Date getGenerationDate() {
		return generationDate;
	}
	public void setGenerationDate(Date generationDate) {
		this.generationDate = generationDate;
	}
	public int getIndentNo() {
		return indentNo;
	}
	public void setIndentNo(int indentNo) {
		this.indentNo = indentNo;
	}
	public int getProjectId() {
		return projectId;
	}
	public void setProjectId(int projectId) {
		this.projectId = projectId;
	}
	public int getState() {
		return state;
	}
	public void setState(int state) {
		this.state = state;
	}
	public int getVersion() {
		return version;
	}
	public void setVersion(int version) {
		this.version = version;
	}
	public IndentItems[] getModelindentItems() {
		return modelindentItems;
	}
	public void setModelindentItems(IndentItems[] modelindentItems) {
		this.modelindentItems = modelindentItems;
	}


	public String getModelprojectName() {
		return modelprojectName;
	}


	public void setModelprojectName(String modelprojectName) {
		this.modelprojectName = modelprojectName;
	}


	public String getModelgeneratedByName() {
		return modelgeneratedByName;
	}


	public void setModelgeneratedByName(String modelgeneratedByName) {
		this.modelgeneratedByName = modelgeneratedByName;
	}


	public Update[] getModelupdates() {
		return modelupdates;
	}


	public void setModelupdates(Update[] modelupdates) {
		this.modelupdates = modelupdates;
	}
	
	
	

}
